package cn.edu.scau.cmi.suwenpeng.chapter01;

import java.util.Scanner;

public class DateUnil {
	  public static boolean isLeapYear(int year){
		   return year%4==0&&year%100!=0||year%400==0;
	   }
	   public static int ordinal(int year,int month,int day){
		  int sum=0;
		  int[] monthArray= {31,28,31,30,31,30,31,31,30,31,30,31};
		  if(isLeapYear(year)) monthArray[1]=29;
		  for(int i=0;i<month-1;i++) {
			  sum+=monthArray[i];
		  }
		  return sum+day;
	   }
	@SuppressWarnings("static-access")
	public static void main(String[] args) {
		DateUnil dateUnil=new DateUnil();
		Scanner input=new Scanner(System.in);
		int year=input.nextInt();
		int month=input.nextInt();
		int day=input.nextInt();
		if(dateUnil.isLeapYear(year)) {
			System.out.print("YES ");
		}
		else {
			System.out.print("NO ");
		}
		int sum=dateUnil.ordinal(year, month, day);
		System.out.println(sum);
		
			
				

	}

}
